一:index.php简介
好长时间没有写博客了,这半年里各种事情,其实一直想写。今天才真正腾出些时间来写。
二:首页源代码分析
<?php //验证 数据文件夹 下是否存在网站的公共配置文件,如果不存在 if(!file_exists(dirname(__FILE__).'/data/common.inc.php')) { //转向到安装文件页面 header('Location:install/index.php'); exit(); } //自动生成HTML版 // $_GET['upcache'] 是指获取缓存文件,其实这里我也不懂,本来只是一个首页,从哪里传参数呢? //如果 能获取缓存文件,或者,根目录下不存在index.html文件 if(isset($_GET['upcache']) || !file_exists('index.html')) { //引入系统公共配置文件 require_once (dirname(__FILE__) . "/include/common.inc.php"); //引入视图类 require_once DEDEINC."/arc.partview.class.php"; //定义公用配置文件为 index $GLOBALS['_arclistEnv'] = 'index'; //$dsql是类文件 dede.sql.php 类,这里用GetOne来获取数据表的一条记录 //homepageset这个表就一条记录,三个字段, //template模板 -默认是default/index.htm , //position模板位置 -默认是根目录下的 ../index.html , //showmode显示状态~即动态显示还是静态显示,1表示动态,0表示静态 $row = $dsql->GetOne("Select * From `#@__homepageset`"); // $row['templet']是获取模板的字段,即 default/index.htm文件 //MfTemplet是引入arc.partview.php类, //MfTemplat('default')返回的结果是……? $row['templet'] = MfTemplet($row['templet']); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']); $row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0; if ($row['showmod'] == 1) { $pv->SaveToHtml(dirname(__FILE__).'/index.html'); include(dirname(__FILE__).'/index.html'); exit(); } else { $pv->Display(); exit(); } } else { header('HTTP/1.1 301 Moved Permanently'); header('Location:index.html'); } ?>